package eco2automotive.data;
import java.io.*;
 /**  
  * Basic element of the structure of a Protocol object
  * This Structure is based on the Protocols.xml file.
  * Structure of XML file:
  * 
 * </br>[masc]	AABB	[/masc]	
 * </br>min]	0	[/min]	
 * </br>[max]	655.35	[/max]	
 * </br>[units]	g/s	[/units]	
 * </br>[formula]	((A*256)+B) /100	[/formula]
  * 
  * @version 1.0
  * @autor Fco. Javier Sánchez Esparza
   * @see eco2automotive.data.Parameter
  */ 
public class ValuePID implements Serializable{
    private double minValue;
    private double maxValue;
    private String formula; 
    private String units;  
    private boolean bitEncoded;
    private String masc;
/** 
* Constructor
 * @param minValue  Minimun value of parameter id
 * @param maxValue  Maximum value of parameter id
 * @param formula   String that contains a mathematical formula for calculate the value.
     * @param masc 
     * @param units 
     * @param bitEncoded 
     * @params masc     Positional mask of the vars
 * @params units    Units
 * @params bitEncoded Boolean, no a mathematical formula assigned.
*/
    public ValuePID(double minValue,double maxValue,String formula, String masc, String units,boolean bitEncoded){
    this.minValue=minValue;
    this.maxValue=maxValue;
    this.formula=formula;
    this.masc=masc;
    this.units=units;
    this.bitEncoded=bitEncoded;
    }
    /**
     * Default constructor
     */
    public ValuePID(){};
    
    /**
     * Set the minimun value
     * @param minValue minimun value
     */    
    public void setMinValue(double minValue){this.minValue=minValue;}
    /**
     * Set the maximun value
     * @param maxValue 
     */    
    public void setMaxValue(double maxValue){this.maxValue=maxValue;}
    /**
     * Set the the formula string
     * @param formula this String contains a mathematical formula
     */    
    public void setFormula(String formula){this.formula=formula;}
    /**
     * Set the the units to be shown
     * @param units eg. "%"
     */    
    public void setUnits(String units){this.units=units;}
    
    /**
     * Set the the positional mask
     * @param masc eg. "AABB" @see documentation of this project
     */    
    public void setMasc(String masc){this.masc=masc;}
     /**
     * Return the minimun value 
     * @return minValue double minimun value
     */    
    public double getMinValue(){return this.minValue;}
     /**
     * Return the maximun value 
     * @return maxValue double minimun value
     */    
    public double getMaxValue(){return this.maxValue;}
    
     /**
     * Return units used
     * @return units String eg. "ºC"
     */    
    public String getUnits(){return this.units;}
    /**
     * Return boolean value
     * @return bitEncoded, true = encoded or false = not encoded
     */    
    public boolean isEncoded(){return this.bitEncoded;}
    /**
     * Return String formula
     * @return formula eg. "((A*256)+B) /100"
     */    
    public String getFormula(){return this.formula;}
    
    /**
     * Return String whit a mask
     * @return masc eg. "AABB"
     * 
     */
    public String getMasc(){return this.masc;}    
}
